home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / mail / transpor / ifmail23.z / ifmail23 / ifmail / ifcico / rdoptions.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-09  |  1.3 KB  |  68 lines

  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include "session.h"
  4. #include "xutil.h"
  5. #include "lutil.h"
  6. #include "nodelist.h"
  7. #include "config.h"
  8.  
  9. extern char *get_modem_string(modem_string*,node*);
  10. extern char *next_modem_string(node*);
  11.  
  12. int localoptions;
  13.  
  14. static struct _ktab {
  15.     char *key;
  16.     int flag;
  17. } ktab[] = {
  18.     {"Call",NOCALL},
  19.     {"Hold",NOHOLD},
  20.     {"PUA",NOPUA},
  21.     {"WaZOO",NOWAZOO},
  22.     {"EMSI",NOEMSI},
  23.     {"Freqs",NOFREQS},
  24.     {"Zmodem",NOZMODEM},
  25.     {"ZedZap",NOZEDZAP},
  26.     {"Janus",NOJANUS},
  27.     {"Hydra",NOHYDRA},
  28.     {NULL,0}
  29. };
  30.  
  31. void rdoptions(node*);
  32. void rdoptions(nlent)
  33. node *nlent;
  34. {
  35.     char *str,*s,*p;
  36.     int i;
  37.  
  38.     localoptions=0;
  39.  
  40.     for (str=get_modem_string(options,nlent);str;
  41.         str=next_modem_string(nlent))
  42.     {
  43.         s=xstrcpy(str);
  44.         debug(10,"applicable option string: \"%s\"",s);
  45.         for (p=strtok(s," \t,");p;p=strtok(NULL," \t,"))
  46.             for (i=0;ktab[i].key;i++)
  47.             {
  48.                 if (strcasecmp(ktab[i].key,p) == 0)
  49.                     localoptions &= ~(ktab[i].flag);
  50.                 else if ((strncasecmp("No",p,2) == 0) &&
  51.                     (strcasecmp(ktab[i].key,p+2) == 0))
  52.                     localoptions |= ktab[i].flag;
  53.             }
  54.         free(s);
  55.         debug(10,"new options value: 0x%04x",localoptions);
  56.     }
  57.     s=NULL;
  58.     for (i=0;ktab[i].key;i++)
  59.         {
  60.             s=xstrcat(s," ");
  61.             if (localoptions & ktab[i].flag)
  62.                 s=xstrcat(s,"No");
  63.             s=xstrcat(s,ktab[i].key);
  64.         }
  65.     loginf("options:%s",s);
  66.     free(s);
  67. }
  68.